<?php

namespace App\Http\Middleware;

use App\Utils\ResponseUtil;
use Closure;
use Illuminate\Http\Request;

class ApiIpBind
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next
     * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    public function handle(Request $request, Closure $next)
    {
        if (config('app.env') == '204') {
            if (!in_array($request->getClientIp() ,['121.22.5.227','219.152.175.93']) ) { // 0 1
                ///return ResponseUtil::error("登录服IP非法:" . $request->getClientIp());
            }
        }
        return $next($request);
    }
}
